package com.example.a79273.shandianban.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.example.a79273.shandianban.fragment.YouRenPageFragment;

import java.util.List;

/**
 * Created by 79273 on 2016/8/30.
 */
public class YouRenFragmentPagerAdapter extends FragmentPagerAdapter {

    private String[] mTitles;
    private List<YouRenPageFragment> mData;

    public YouRenFragmentPagerAdapter(FragmentManager fm, String[] titles, List<YouRenPageFragment> data) {
        super(fm);
        mTitles = titles;
        mData = data;
    }

    @Override
    public Fragment getItem(int position) {
        return mData.get(position);
    }

    @Override
    public int getCount() {
        return mData == null ? 0 : mData.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mTitles[position];
    }
}
